package me.skyun.androidarch.connect;

import java.io.IOException;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.Socket;

/**
 * Created by skyun on 17/8/25.
 */

public class TcpClient extends ConnClient<Socket> {

    private String mIP;
    private int mPort;

    public TcpClient(String mIP, int port, Connection.Callback callback) {
        super(callback);
        this.mIP = mIP;
        this.mPort = port;
    }

    @Override
    protected Socket connect() throws IOException {
        Socket socket = new Socket();
        socket.connect(new InetSocketAddress(InetAddress.getByName(mIP), mPort));
        return socket;
    }

    @Override
    protected String getRemoteName() {
        return null;
    }
}
